﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPF.DEMO.Pages
{
    /// <summary>
    /// MultiMediaPage.xaml 的交互逻辑
    /// </summary>
    public partial class MultiMediaPage : Page
    {
        public MultiMediaPage()
        {
            InitializeComponent();
            this.Loaded += MultiMediaPage_Loaded;
        }

        private void MultiMediaPage_Loaded(object sender, RoutedEventArgs e)
        {
            mmb.SetFolderSource(this.MapPath("res", "MultiMedia"));
            mmb1.SetFolderSource(this.MapPath("res", "MultiMedia"));
        }

        private int lastIndex = 0;
        private void mmb_CurrentIndexChanged(object sender, RoutedEventArgs e)
        {
            lastIndex = mmb.CurrentIndex;
        }

        private void mmb_ApplyingMedia(object sender, RoutedEventArgs e)
        {
            if (mmb.CurrentIndex > lastIndex)
            {
                tec.TransitionEffectType = SharpSoft.WPF.Controls.TransitionEffectType.SlideIn;
                tec.SnapshotAndStart();
            }
            else if (mmb.CurrentIndex < lastIndex)
            {
                tec.TransitionEffectType = SharpSoft.WPF.Controls.TransitionEffectType.SlideOut;
                tec.SnapshotAndStart();
            }

        }

        private void btn_prv1_Click(object sender, RoutedEventArgs e)
        {
            mmb1.Previous(TimeSpan.FromSeconds(0.5));
        }

        private void btn_next1_Click(object sender, RoutedEventArgs e)
        {
            mmb1.Next(TimeSpan.FromSeconds(5.1));
        }


    }
}
